<%@page language="java" contentType="text/html; charset=UTF-8" isELIgnored="false" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="html" tagdir="/WEB-INF/tags" %>
<!DOCTYPE html>
<html>
<html:header title="单号规则">

    <link rel="stylesheet" href="${baseUrl}css/public.css" media="all">
    <style type="text/css">
        .readonly{
            background-color: #eeeeee;
        }
    </style>
    <script>
        jQuery(function () {
            fixTableOperatorButton();
        });

        layui.use(['form', 'table'], function () {
            var $ = layui.jquery,
                form = layui.form,
                table = layui.table;

            renderTable();
        });

        function renderTable() {
            layui.table.render({
                id:'table',
                elem: '#table',
                url: "${baseUrl}sett/orderRule/getOrderRules.action?time="+(new Date()).valueOf(),
                cols: [[
                    {type: "numbers", width: 30},
                    {field: 'id', width: 10, title: 'ID',hide:true},
                    {field: 'name', width: 200, title: '编号类型',style:"font-size:12px;"},
                    {field: 'prefix', width: 200, title: '编号规则',style:"font-size:12px;",templet:function (d) {
                            return d.prefix + "{YYYY}{MM}{DD}{##}";
                        }},
                    {field: 'num', width: 150, title: '编号位数',style:"font-size:12px;"},
                    {field: 'current',width: 150, title: '当前编号',style:"font-size:12px;"},
                    {title: '操作', fixed:'right', minWidth: 80, templet: '#operBar'},
                ]],
                limit: 10,
                page: { //支持传入 laypage 组件的所有参数（某些参数除外，如：jump/elem） - 详见文档
                    layout: ['limit', 'count', 'prev', 'page', 'next', 'skip'] //自定义分页布局
                    //,curr: 5 //设定初始在第 5 页
                    ,groups: 5 //只显示 5 个连续页码
                    ,first: false //不显示首页
                    ,last: false //不显示尾页
                },
                done: function(res, curr, count){
                }
            });

            layui.table.on('tool(table)', function (obj) {
                if (obj.event === 'edit') {
                    openTab("编辑单号规则","${baseUrl}sett/orderRuleEdit.action?id="+obj.data.id);
                }

            });
        }

    </script>

</html:header>
<body>
<div class="layuimini-container">
    <div class="layuimini-main">
        <input type="hidden" id="companyId" value="${companyId}">

        <table class="layui-hide" id="table" lay-filter="table"></table>

        <script type="text/html" id="operBar">
            <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
        </script>
    </div>
</div>

</body>
</html>